//
//  HYOnlineMidCell.m
//  HaiYue
//
//  Created by tucici on 2019/3/13.
//  Copyright © 2019 skyline. All rights reserved.
//

#import "HYOnlineMidCell.h"
@interface HYOnlineMidCell()
@property (nonatomic, strong) HYLabel *leftLBL;
@property (nonatomic, strong) HYButton *rightBtn;
@property (nonatomic, strong) HYView *line;

@end
@implementation HYOnlineMidCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.separatorInset = UIEdgeInsetsMake(0, SCREEN_WIDTH, 0, 0);
        self.leftLBL.hidden = self.rightBtn.hidden = NO;
        self.line.hidden = NO;
    }
    return self;
}

- (HYLabel *)leftLBL
{
    if (!_leftLBL)
    {
        _leftLBL = [[HYLabel alloc]initWithText:@"新游预约" textColor:THEME_COLOR];
        _leftLBL.font = [UIFont systemFontOfSize:15 weight:UIFontWeightLight];
        [self addSubview:_leftLBL];
        [_leftLBL mas_updateConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY).with.offset(- GAP / 2.0);
            make.left.equalTo(self).with.offset(GAP);
        }];
    }
    return _leftLBL;
}

- (HYButton *)rightBtn
{
    if (!_rightBtn)
    {
        _rightBtn = [[HYButton alloc]initWithFrame:CGRectMake(0, 0, 60, CGRectGetHeight(self.leftLBL.bounds)+GAP) title:@"更多" titleColor:THEME_COLOR];
        _rightBtn.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightLight];
        _rightBtn.type = CCShapeLayerTypeLeftHalfEllipse;
        _rightBtn.strokeColor = _rightBtn.titleLabel.textColor;
        _rightBtn.fillColor = RGBA(233, 78, 96, 0.1);
        [_rightBtn addTarget:self action:@selector(actionForMoreBtn) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_rightBtn];
        [_rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self);
            make.centerY.equalTo(self.leftLBL);
            make.size.mas_equalTo(self.rightBtn.bounds.size);
        }];
    }
    return _rightBtn;
}

- (HYView *)line
{
    if (!_line)
    {
        _line = [[HYView alloc] initWithColor:LINE_COLOR];
        [self addSubview:_line];
        [_line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self);
            make.right.equalTo(self);
            make.bottom.equalTo(self);
            make.height.mas_equalTo(GAP);
        }];
    }
    return _line;
}
- (CGFloat)H
{
    return GAP * 3.0 + CGRectGetHeight(self.leftLBL.bounds);
}

- (void)actionForMoreBtn
{
    [CCNotice post:CCNoticeNameOnlineMidCellMore obj:nil info:nil];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
}
- (void)awakeFromNib
{
    [super awakeFromNib];
    // Initialization code
}


@end
